package com.ts.webapplication.mapper;

import com.ts.webapplication.entity.User;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;

/**
 * @author tiansong
 * @create 2019/6/1/001 - {TIME}
 */

public interface UserMapper {
    @Select("select * from user")
    ArrayList<User> findAll();

    @Select("select * from user where id=#{id}")
    User find(User user);
    @Delete("delete from user where id=#{id}")
    void delete(User user);
    @Update("update user set name=#{name} where id=#{id}")
    void update(User user);
    @Insert("insert into user(name,password,email,age) values(#{name},#{password},#{email},#{age})")
    void add(User user);
    @Select("select * from user where name=#{name}")
    ArrayList<User> findUserByName(User user);

    @Select("SELECT name from user WHERE name LIKE #{name}")
    ArrayList<String> findUserByLikeName(String name);
 /*   @Insert("insert into user(name,password,email,age) values(#{user.name},#{user.password},#{user.email},#{user.age})")
    public  void addBatch(ArrayList<User> users);*/
}
